package com.kgc.project.projectmanagerweb.controller;

import com.kgc.project.bean.Projectinfo;
import com.kgc.project.service.ProService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProController {

    @Reference
    ProService proService;
    @RequestMapping("/selePro")
    public String selePro(@RequestParam(value = "status",required = false,defaultValue = "0")Integer status,
                          @RequestParam(value = "pageNum",required = false,defaultValue = "1")Integer pageNum){
        String proByStatus = proService.getProByStatus(status, pageNum);
        return proByStatus;
    }


    @RequestMapping("/seleById")
    public Projectinfo seleById(Integer id){
        Projectinfo byId = proService.getById(id);
        return byId;
    }

    @RequestMapping("/upPro")
    public String upPro(@RequestBody Projectinfo projectinfo){
        Integer integer = proService.upPro(projectinfo);
        if(integer>0){
            return "SUCCESS";
        }else{
            return "FAIL";
        }
    }
}
